<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <div id="app">
    <home></home>
  </div>
  <script src="./vue.js"></script>
  <script>
    // 定义一个混入
    const mixin = {
      data(){
        return {
          msg: '这是混入中的数据'
        }
      },
      computed: {
        reverseMsg(){
          return this.msg.split('').reverse().join('')
        }
      }
    }
    const Home = {
      template: `
        <div>
          <h2>这是父组件</h2>  
          {{ msg }}
          <br/>
          {{ reverseMsg }}
        </div>
      `,
      mixins: [mixin],
      data(){
        return {
          // msg: 'hello world'
        }
      }
    }
    Vue.component('Home', Home)
    const vm = new Vue({
      el: '#app',
      data: {
        isShow: true
      }
    })
  </script>
</body>
</html>